<template>
  <div class="order-evaluation">
    <div class="title">企业评价</div>

    <!-- 概括评价 -->
    <div class="general">
      <div class="stars">
        <div class="item">
          <p>服务评价</p>
          <Rate v-model="serviceStar" show-text :texts="starTexts" text-color="#E48B2C"/>
        </div>
        <div class="item">
          <p>交期评价</p>
          <Rate v-model="deliveryStar" show-text :texts="starTexts" text-color="#E48B2C"/>
        </div>
      </div>

      <div class="evaluation">
        <Input type="textarea" placeholder="评价内容" v-model="evaluation"/>
      </div>
    </div>

    <!-- 详细评价 -->
    <div class="detailed">
      <div class="item" v-for="(item, index) in order.data" :key="index">
        <div class="img-and-name">
          <img :src="item.img" alt="">
          <div class="name">{{ item.name }}</div>
        </div>

        <div class="star">
          <p>产品评价</p>
          <Rate v-model="item.star" show-text :texts="starTexts" text-color="#E48B2C"/>
        </div>

        <div class="evaluation">
          <Input type="textarea" placeholder="评价内容" v-model="item.evaluation"/>
        </div>
      </div>
    </div>

    <div class="btn">
      <div class="submit">提交</div>
    </div>
  </div>
</template>

<script>
import { Input, Rate } from 'element-ui'
// import { getDetails } from '@/api/material'

export default {
  name: 'OrderEvaluation',
  components: { Rate, Input },
  data() {
    return {
      orderId: '',
      order: {},
      starTexts: ['1分', '2分', '3分', '4分', '5分'],
      serviceStar: 5,
      deliveryStar: 5,
      evaluation: ''
    }
  },
  created() {
    this.orderId = this.$route.query.id

    // getDetails().then(res => {
    //   this.order = res.data.data
    // })
  }
}
</script>

<style lang="scss" scoped>
@import "~@/assets/style/common.scss";

.order-evaluation {
  border: solid 1px #eaeaea;
  padding: 15px 30px;
  margin-bottom: 200px;

  .title {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 15px;
  }

  .general {
    display: flex;
    margin-bottom: 40px;

    .stars, .evaluation {
      width: 50%;
    }

    .stars {
      display: flex;
      flex-direction: column;

      .item {
        margin-bottom: 15px;
        display: flex;

        p {
          margin-right: 10px;
        }
      }
    }
  }

  .detailed {
    margin-bottom: 40px;

    .item {
      display: inline-block;
      width: 47%;
      background-color: #F3F4F8;
      padding: 15px;
      margin: 15px 12px;
      font-size: 16px;

      .img-and-name {
        display: flex;
        margin-bottom: 15px;

        img {
          width: 140px;
          height: 140px;
          margin-right: 15px;
        }
      }

      .star {
        display: flex;
        margin-bottom: 15px;

        p {
          margin-right: 15px;
        }
      }
    }
  }

  .btn {
    display: flex;
    justify-content: center;
    margin-bottom: 40px;

    .submit {
      width: 185px;
      height: 35px;
      background-color: $theme-color-1;
      color: #fff;
      font-size: 16px;
      border-radius: 10px;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
    }
  }
}
</style>
